home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr52 / expand53.zip / XPDEMO.ZIP / XPMISC.PRG < prev    next >
Text File  |  1992-08-17  |  6KB  |  200 lines

  1. * ------------------------------------------------------------------------
  2. * Module......:    XPMISC.PRG
  3. * Title.......: DOS part of the Expand Library Demonstration Program
  4. * Author......:    Pepijn Smits.
  5. * Date........:    July/August 1992
  6. * Copyright...:    (c)1992 by Softwarebureau Pepijn Smits
  7. * Notes.......:    Clipper 5.01 Demo of the Expand Library
  8. *        Some general Miscellanous functions
  9. *        See XPDEMO.RMK For Compile and Link instructions.
  10. * ------------------------------------------------------------------------
  11.  
  12. Function HexDump()
  13. Local h := fopen(PCXname(),0)
  14. Local buffer := space(1024)
  15. if ferror()=0
  16.     fread(h,@buffer,1024)
  17.     XPbrowse(' ~Hex~ dump of 1st 1024 bytes of ~'+PCXname()+' ',;
  18.         '  Ofs  00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F   Characters',;
  19.         {|i|HexLine(i,@buffer)})
  20. else
  21.     XPalert('~Hex~ dump error','Could not find the dump file ~'+PCXname())
  22. end
  23. Return (NIL)
  24.  
  25. Static Function HexLine(i,buffer)
  26. Local c
  27. local buf := SubStr(buffer,16*(i-1),16)
  28. if i=0
  29.     Return (1024/16)
  30. else
  31.     c := '  '+XPhexWord(16*(i-1))+' '+XPhexStr(buf) + '  ' + ;
  32.         XPhexLstrip(buf)
  33. end
  34. Return (c)
  35.  
  36. Function TestDial
  37. Local port,prefix,Number,i
  38. Local portMenu := {}
  39. for i := 1 to 4 
  40.    aAdd(portMenu,'COM~'+Str(i,1)+':')
  41. next
  42. Port := XPalert('~Voice~ Dial','Select ~COM~ Port where Modem is connected to',PortMenu)
  43.  
  44. /* If Port was selected, Go On */
  45. if Port<>0
  46.     XPpushScr()
  47.     Port--
  48.     /* Is there a Damn COM port anyway? */
  49.     if XPisPort(Port)
  50.         prefix := If(XPalert('Dial','Which dialing mode shall I use?',;
  51.             {'~T~one','~P~ulse'})=1,'ATDT','ATDP')
  52.         Number := prompt('Dial','Please Enter Number to dial:','')
  53.         if !Empty(Number)
  54.             XPdtr(.t.,port)
  55.             XPatModem( prefix+Number+';',port)
  56.             XPpop('Dialing','Currently ~dialing~;'+Number+';'+;
  57.                      'Pick up ~phone~ any time and;press a key or click the Mouse;when the phone rings')
  58.             XPmouseKey()
  59.             XPdtr(.f.,port)
  60.         end
  61.     else
  62.         XPalert('Dial','You selected an Non-Existant ~COM~ Port!')
  63.     end
  64.     XPpopScr()
  65. end
  66. Return (NIL)
  67.  
  68. Function Test123
  69. XPpushScr()
  70. XPpop('~1-2-3~ Test',' Creating ~EXPAND.WK1~..')
  71. if XPcreate123('EXPAND.WK1',5,1)
  72.     XPWidth123(0,20)
  73.     XPWidth123(1,40)
  74.     XPWrite123(0,0,'Ah! There you are!') 
  75.     XPWrite123(0,1,'Yes, I was just created by the Expand Library!.')
  76.     XPWrite123(1,0,2342)
  77.     XPWrite123(1,1,'<- a number')
  78.     XPWrite123(2,0,7623.2393,2)
  79.     XPWrite123(2,1,'<- a number with 2 decimals..')
  80.     XPWrite123(3,0,date())
  81.     XPWrite123(3,1,'<- this should be today..')
  82.     XPWrite123(4,0,XPstoD('19670308'))
  83.     XPWrite123(4,1,'<- and this is my birthdate..')
  84.     XPWrite123(5,0,'That was it..')
  85.     XPWrite123(5,1,'Okidoki.. Return to the Expand Library now..')
  86.  
  87.     XPwrite123(6,0,'Some Extra Functions:')
  88.     XPrepl123(7,0,'-')
  89.     XPrepl123(8,0,'/\')
  90.     XPcenter123(9,0,'Cntr')
  91.     XPright123(10,0,'Right')
  92.     XPperc123(11,0,18.5)
  93.     XPperc123(12,0,0.1,4)
  94.     XPcurr123(13,0,12.5)
  95.     XPcurr123(14,0,1129391,1)
  96.  
  97.     XPClose123()
  98.     XPalert('~1-2-3~ Test',' Created EXPAND.WK1;Use ~1-2-3~ to see what is in it!')
  99. else
  100.     XPalert('~1-2-3~ Error','Could not create ~EXPAND.WK1~!')
  101. end
  102. XPpopScr()
  103. Return (NIL)
  104.  
  105. Function JoyTest()
  106. XPalert('Sorry',;
  107.     "I couldn't find a ~Joystick~ in time for the testing of;"+;
  108.     "these routines. Please try them out yourself if you happen to own one")
  109. /*
  110. XPpushScr()
  111. XPbox2(6,6,20,74,'~Joystick~ Test')
  112. XPcenter(8,'This is your current Joystick status (if you have any)')
  113. XPcenter(18,'Press ~any~ key or ~click~ the mouse to continue')
  114.  
  115. While (XPinkey()=0) .and. (XPmouseStat()=0)
  116. //    XPdisplay(10,10,'Joystick 1 '+if(XPjoy1(),"Pressed ","Released"))
  117. end
  118. XPpopScr()
  119. */
  120. Return (NIL)
  121.  
  122. Function MachInfo()
  123.  
  124. XPalert('~Machine~ Information',;
  125.  PadR("CPU          : ~" + XPcpuStr(),60)+";"+;
  126.  PadR("ROM date     : ~" + DtoC(XPromdate()),60)+";"+;
  127.  PadR("ROM ID byte  : ~" + XPhexByte(XPromID())+'h',60)+";"+;
  128.  PadR("ICA Contents : ~" + XPhexStr(XPica()),60))
  129.  
  130. Return (NIL)
  131.  
  132. Function MachID()
  133. Local x
  134. begin sequence
  135. x := (Prompt('Machine ~Identification~','Give an Identification to look-Up in ROM',''))
  136. if !empty(x)
  137.     if XPROMscan(x)
  138.         XPalert('Machine ~ID~','Well, it look like this computer is a;~'+;
  139.         x+'~;(string was found in ROM)')
  140.     else
  141.         XPalert('Machine ~ID~','Sorry, this computer is not a;~'+;
  142.         x+'~;(string not found in ROM)')
  143.     end
  144. end
  145. end
  146. Return (NIL)
  147.  
  148. Function BootWarm()
  149. if XPask('~Warm~ boot','Are you sure you want to Reboot the Computer?')
  150.     XPwarmboot()
  151. end
  152. Return (NIL)
  153.  
  154. Function BootCold()
  155. if XPask('~Cold~ boot','Are you sure you want to Restart the Computer?')
  156.     XPcoldboot()
  157. end
  158. Return (NIL)
  159.  
  160. Function PCXtest()
  161. Local PCX := {"XPDEMO.PCX","CLOWN.PCX","SPS.PCX"}
  162. Local i := XPalert('~PCX~ viewer',;
  163.     "Which of the following PCX files would you like to view?",;
  164.     {'~I~ntro Screen (EGA)','~C~lown (VGA: 256 Colors)','SPS ~L~ogo (VGA: 16 Colors'})
  165. Local x,nCode
  166. if i>0
  167.     SET CURSOR ON
  168.     XPpushScr()
  169.     x := XPvmode()
  170.     nCode := XPfastPCX(PCX[i])
  171.     do case
  172.     case nCode == 0            // All Okay..
  173.         XPmouseKey()        // Wait..
  174.         XPvmode(x)        // Restore text..
  175.         inkey(.3)
  176.         SET CURSOR OFF
  177.     case nCode == 1
  178.         XPalert("~PCX~ view",;
  179.             "Error: File not Found ~"+PCX[i])
  180.     case nCode == 2
  181.         XPalert("~PCX~ view",;
  182.             "Error: File is not a PCX file ~"+PCX[i])
  183.     case nCode == 3
  184.         XPalert("~PCX~ view",;
  185.             "Error: Unsupported format, file ~"+PCX[i]+";"+;
  186.             "~XPfastPCX()~ only supports the following formats:;;"+;
  187.             "640x350x16 EGA ;"+;
  188.             "640x480x16 VGA ;"+;
  189.             "320x200x256 VGA;")
  190.     case nCode == 4
  191.         XPalert("~PCX~ view",;
  192.             "Error: File is too big ~"+PCX[i])
  193.     case nCode == 5
  194.         XPalert("~PCX~ View",;
  195.             "Error: You do not have the required hardware")
  196.     endcase
  197.     XPpopScr()
  198. end
  199. Return (NIL)
  200.